package com.tj.collection.db.enums;

import com.fqgj.exception.enums.ErrorCodeEnum;
import org.springframework.http.HttpStatus;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/9/28
 * Time: 上午9:30
 */
public enum RestErrorCodeEnum implements ErrorCodeEnum {
    TOKEN_NOT_AVAILABLE(700, "Token Invalid", HttpStatus.OK),
    REPAYMENT_CALLBACK_ERROR(910001, "还款失败", HttpStatus.BAD_REQUEST),
    SYSTEM_PARAMTER_ERROR(11000, "System parameter verification failed", HttpStatus.OK),
    CLICK_ONLY_ONCE(90024, "Please click only once.", HttpStatus.INTERNAL_SERVER_ERROR),
    SYSTEM_ERROR(99999, "System error", HttpStatus.OK),
    ;
    private Integer code;

    private String msg;

    private HttpStatus httpStatus;

    RestErrorCodeEnum(Integer code, String msg, HttpStatus httpStatus) {
        this.code = code;
        this.msg = msg;
        this.httpStatus = httpStatus;
    }

    public RestErrorCodeEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public RestErrorCodeEnum setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public RestErrorCodeEnum setHttpStatus(HttpStatus httpStatus) {
        this.httpStatus = httpStatus;
        return this;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public HttpStatus getHttpStatus() {
        return httpStatus;
    }
}
